'use strict';

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  const { router, controller } = app;
  // 在路由中使用的中间件
  const auth = app.middleware.auth()

  router.get('/', controller.users.index);
  router.post('/api/login', controller.users.login);

  router.post('/api/add', auth, controller.home.add)
  router.post('/api/update', auth, controller.home.update)
  router.get('/api/delete', auth, controller.home.delete)

  router.get('/api/page', controller.home.page);
  router.get('/api/findAll', controller.home.findAll)
  router.get('/api/findId', controller.home.findId)
  router.get('/api/search', controller.home.search)

};
